package com.franklin.ideaplugin.api.ui.tree;

import com.franklin.ideaplugin.api.utils.ProjectUtils;
import com.intellij.openapi.project.Project;
import com.intellij.ui.treeStructure.CachingSimpleNode;
import com.intellij.ui.treeStructure.SimpleNode;

import javax.swing.*;
import java.util.Collections;
import java.util.List;

/**
 * @author: Ye Junhui
 * @since : 2022/4/2 0002
 */
public abstract class BaseSimpleNode<child extends BaseSimpleNode<child>> extends CachingSimpleNode {

    protected final Project project;

    protected List<child> childrenNodeList = Collections.emptyList();

    protected BaseSimpleNode(SimpleNode aParent) {
        super(aParent);
        this.project = ProjectUtils.getCurrProject();
    }

    public List<child> getChildrenNodeList() {
        return childrenNodeList;
    }

    public void setChildrenNodeList(List<child> childrenNodeList) {
        this.childrenNodeList = childrenNodeList;
    }

    public Project getNodeProject(){
        return this.project;
    }

    public abstract Icon getMyIcon();
}
